
<table height="320px" width="603px" >
				<tr><td id="info" valign="top">
					<table cellpadding="0" cellspacing="0" >
						<tr><td width="395px" valign="top">
						<?php include 'navbar.php'; ?>
						</td>
						<td>&nbsp;</td>
						<td valign="top">
							<table cellpadding="0" cellspacing="0" border="0" align="right" width="185px"><tr><td><div align="right">
							<?php 
							$username = $_SESSION['username'];          					$query = "select * from user where username='$username'";         					$result = mysql_query($query);
							$user = mysql_fetch_array($result);
							include 'usergreet.php'; ?></div>
							</td></tr><tr><td id="login"><div align="right"><span style="font-size:12px"><? echo $user['nick']; ?></span> ( <strong><a href="index.php?act=logout">Logout</a></strong> )</div></td></tr></table>
					

						</td></tr>
					</table>

					<table cellpadding="0" cellspacing="0"><tr><td width="385px" valign="top">
					<div align="left">
						<span style="font-size:8pt"><p /><?php 					
									if (!isset($_POST['submit'])) {     									include 'editprof_form.inc.php';									}
else							{ 							    // Check if any of the fields are missing     							if (empty($_POST['nick']) && $error=='0')     							{          							// Reshow the form with an error          							$editprof_error = 'Please enter your Online Mii Name';
									$error = '1';          							include 'editprof_form.inc.php';     							}



								$gamecode = $_POST['gamecode'];								$checkuser = mysql_query("SELECT gamecode FROM user WHERE gamecode='$gamecode'");								$gamecode_exist = mysql_num_rows($checkuser);								if($gamecode_exist > 0 && $gamecode != $user['gamecode'] && $error=='0')
								{   							    	$editprof_error = "Friend Code is currently used";
									$error = '1';									include 'editprof_form.inc.php';								}	
								if (!is_numeric ($_POST['gamecode']) || strlen($_POST['gamecode']) != 12)								{									$editprof_error = 'Your Friend Code is invalid...';
									$error = '1';          							include 'editprof_form.inc.php';								}
								if (!is_numeric ($_POST['racevr']) || !is_numeric ($_POST['battlevr']) )								{									$editprof_error = 'Your VR is invalid...';
									$error = '1';          							include 'editprof_form.inc.php';								}

								if (empty($editprof_error)) {
									edit_user($user['username'], $_POST['password'], $_POST['nick'], $_POST['gamecode'], $_POST['battlevr'], $_POST['racevr'],$_POST['character']);
									echo 'Your profile info has been updated!';							} else {$error='0'; $editprof_error='';}

							}
							 ?></span></td><td valign="top">
						<?php include 'sidebar.php' ?>					
					</td>

					</tr></table>
				
					</td></tr>
			</table>
			</td>
		</tr>
	</table>

<?php include 'footer.php' ?>
